diff options
Diffstat (limited to 'app/api/auth/[...nextauth]')
| -rw-r--r-- | app/api/auth/[...nextauth]/saml/provider.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/api/auth/[...nextauth]/saml/provider.ts b/app/api/auth/[...nextauth]/saml/provider.ts index 1f891661..8486a690 100644 --- a/app/api/auth/[...nextauth]/saml/provider.ts +++ b/app/api/auth/[...nextauth]/saml/provider.ts @@ -248,7 +248,11 @@ export async function createNextAuthToken(user: User): Promise<string> { // NextAuth 세션 쿠키 이름 가져오기 export function getSessionCookieName(): string { - return process.env.NODE_ENV === 'production' + // NEXTAUTH_URL이 HTTPS인 경우에만 __Secure- 접두사 사용 + const nextAuthUrl = process.env.NEXTAUTH_URL || ''; + const isHttps = nextAuthUrl.startsWith('https://'); + + return isHttps ? '__Secure-next-auth.session-token' : 'next-auth.session-token'; } |
